# coding:utf-8

from lib.base_ios import Base

from page.ios import train_12306_order_list_page, train_common_passenger_page, train_account_12306_page

__author__ = 'weixin.yuan'


class TrainAccount12306(Base):
    """12306用户管理"""
    def __init__(self, method_name):
        Base.__init__(self, method_name)

        """
        本页元素
        """
        self.account_12306_title = train_account_12306_page.elements['12306账号管理title']
        self.account_btn = train_account_12306_page.elements['账号']
        self.mobile_btn = train_account_12306_page.elements['手机号']
        self.passenger_btn = train_account_12306_page.elements['常用乘客']
        self.order_12306_btn = train_account_12306_page.elements['12306订单']
        self.cancel_btn1 = train_account_12306_page.elements['取消按钮1']
        self.cancel_btn2 = train_account_12306_page.elements['取消按钮2']
        """
        外部页面元素
        """
        self.passenger_title = train_common_passenger_page.elements['常用乘客title']
        self.order_12306_title = train_12306_order_list_page.elements['12306订单列表title']

    def test_account_12306(self):
        """12306用户管理"""
        self.open_schema_ios('6007')
        self.click_exists()
        self.check(self.account_12306_title)

        self.click(self.account_btn)  # 账号
        self.click(self.cancel_btn2)  # 取消
        self.click(self.mobile_btn)  # 手机
        self.click(self.cancel_btn1)  # 取消

        self.click(self.passenger_btn)  # 常用乘客
        self.check(self.passenger_title)
        self.back()

        self.click(self.order_12306_btn)  # 12306订单
        self.check(self.order_12306_title)
        self.back()


